package com.ck.server.controller.test;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ck
 * @date 2023/3/24 15:21
 */
@RestController
@Api(tags ="权限认证接口测试")
public class SecurityController {

    @RequestMapping("/hello1")
    @PreAuthorize("hasAuthority('test')")
    @ApiOperation(value = "权限测试")
    public String securityTest1(){
        return "true";
    }

    @RequestMapping("/hello2")
    @PreAuthorize("hasAuthority('test1')")
    @ApiOperation(value = "权限测试")
    public String securityTest2(){
        return "false";
    }
}
